<template>
    <div class="integralshop">
        <!-- 积分商城 -->
        <BackBtn />
        <div class="header">
            <div class="header-top">
                <div class="integral">
                    <div class="num">520</div>
                    <div class="text">可用积分</div>
                </div>
                <img src="./images/积分logo.png" />
            </div>
            <ul>
                <li @click="$router.push('/integralshop/integraldetailed')">
                    <img src="./images/积分明细.png" /><span class="li-title">积分明细</span>
                </li>
                <li @click="$router.push('/order')">
                    <img src="./images/积分订单.png" /><span class="li-title">积分订单</span>
                </li>
                <li @click="goRule">
                    <span class="iconfont icon-dingdandingdanmingxishouzhimingxi-xianxing"></span><span
                        class="li-title">积分规则</span>
                </li>
            </ul>
        </div>
        <main>
            <div class="ticket" v-for="(item, index) in ticketList" :key="index">
                <div class="ticket-title">{{ item.type }}</div>
                <ul>
                    <li v-for="(ticket, index2) in item.tickets" :key="index2" @click="goTicketDetails(item.ticketTypeId, ticket.id)">
                        <img :src="ticket.imgUrl" />
                        <div class="ticket-content">
                            <div class="title">{{ ticket.title }}</div>
                            <div class="bottom">
                                <div class="price">{{ ticket.price }}<span>积分</span></div>
                                <div class="remain">
                                    剩余<span>{{ ticket.remain }}</span>
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </main>
        <footer>暂无更多活动商品</footer>
        <router-view></router-view>
    </div>
</template>

<script>
import ticketList from "./ticket";
export default {
    data() {
        return {
            ticketList: ticketList,
        };
    },
    methods: {
        goRule() {
            this.$router.push("/integralshop/rule");
        },
        goTicketDetails(typeId, ticketId) {
            this.$router.push(`/ticketdetails/${typeId}/${ticketId}`);
        },
    }
};
</script>

<style lang="less" scoped>
.header {
    height: 140px;
    background-color: #fff;
    margin-bottom: 20px;
    padding-top: 20px;

    .header-top {
        height: 90px;
        padding: 10px 30px 0 20px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .integral {
            display: flex;
            align-items: baseline;
            color: #143b9c;

            .num {
                font-size: 40px;
                font-weight: bold;
            }

            .text {
                font-size: 16px;
                font-weight: bold;
                margin-left: 10px;
            }
        }
    }

    ul {
        display: flex;
        align-items: center;
        padding: 10px;
        box-sizing: border-box;

        li {
            display: flex;
            align-items: center;
            margin-right: 15px;
            color: #666666;

            .li-title {
                font-size: 13px;
                margin-left: 3px;
            }

            img {
                width: 20px;
                height: 20px;
            }

            .iconfont {
                font-size: 20px;
            }
        }
    }
}

.ticket {
    padding: 10px 0 0 0;

    .ticket-title {
        margin-bottom: 20px;
        font-weight: 500;
        font-size: 17px;
        margin-left: 20px;
    }

    ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;

        li {
            width: 170px;
            height: 250px;
            background-color: #fff;
            box-shadow: 0 0 3px rgb(0 0 0 / 20%);
            border-radius: 10px;
            box-sizing: border-box;
            margin-bottom: 15px;

            img {
                width: 170px;
                height: 170px;
            }

            .ticket-content {
                height: 80px;
                padding: 10px 10px;
                box-sizing: border-box;
                display: flex;
                flex-direction: column;
                justify-content: space-around;

                .title {
                    font-size: 16px;
                    font-weight: 600;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }

                .bottom {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;

                    .price {
                        font-size: 18px;
                        font-weight: 600;
                        color: #143b9c;
                        display: flex;
                        align-items: center;

                        span {
                            font-size: 13px;
                            font-weight: 400;
                            margin-left: 3px;
                        }
                    }

                    .remain {
                        font-size: 12px;
                        font-weight: 400;
                        margin-left: 3px;
                        color: #999;

                        span {
                            margin-left: 3px;
                        }
                    }
                }
            }
        }
    }
}

footer {
    width: 100%;
    height: 120px;
    text-align: center;
    line-height: 120px;
    color: #999;
    font-size: 15px;
}
</style>
